﻿@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<CoiniumServ.Server.Web.Models.Pool.AccountModel>
@{ Layout = "layout/main.cshtml"; }

<div class="row">
    <div class="col-md-12">
        <div class="box box-solid box-danger">
            <div class="box-header">
                <h3 class="box-title">Payment Details</h3>
            </div>
            <div class="box-body no-padding">
                @if (Model.Payments.Count == 0)
                {
                    <div class="box-footer">
                        No more payments exist..
                    </div>
                }
                else
                {
                    <table class="table table-striped">
                        <tbody>
                            <tr>
                                <th class="hidden-xs" title="Id of the payment">Payment Id</th>
                                <th title="Block height for the payment">Block</th>
                                <th title="Amount of the payment">Amount</th>
                                <th class="hidden-xs" title="Is the payment executed?">Fullfilled</th>
                                <th class="hidden-xs" title="Id of the transaction">Tx Id</th>
                                <th class="hidden-xs" title="Date of the payment">Date</th>
                            </tr>
                            @foreach (var paymentDetails in @Model.Payments)
                            {
                                <tr>
                                    <td class="hidden-xs">@paymentDetails.PaymentId</td>
                                <td><a href="/pool/@Model.Coin.Symbol/block/@paymentDetails.Block">@paymentDetails.Block</a></td>
                                    <td>
                                        @if (paymentDetails.Completed)
                                        {
                                            @: @paymentDetails.Amount @paymentDetails.Currency
                                        }
                                        else
                                        {
                                            @: @paymentDetails.Amount @Model.Coin.Symbol
                                        }
                                    </td>
                                    <td class="hidden-xs"><div class="label @(paymentDetails.Completed ?"bg-green":"bg-red")">@(paymentDetails.Completed ? "Yes" : "No")</div></td>
                                    <td class="hidden-xs">
                                        @if (paymentDetails.Completed)
                                        {
                                            <a href="/pool/@Model.Coin.Symbol/tx/@paymentDetails.TransactionId">@paymentDetails.TransactionId</a>
                                        }
                                        else
                                        {
                                            @:-
                                        }
                                    </td>
                                    <td class="hidden-xs">
                                        @(paymentDetails.Completed ? paymentDetails.TransactionDate : paymentDetails.PaymentDate)
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                }
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        @if (Model.PaginationQuery.Page - 1 >= 1)
        {
            <a href="/pool/@Model.Coin.Symbol/account/address/@Model.Account.Address/@(Model.PaginationQuery.Page - 1)" type="button" class="btn btn-default btn-sm"><i class="fa fa-angle-double-left"></i> Prev</a>
        }
        <a href="/pool/@Model.Coin.Symbol/account/address/@Model.Account.Address/@(Model.PaginationQuery.Page + 1)" type="button" class="btn btn-default btn-sm pull-right"><i class="fa fa-angle-double-right"></i> Next</a>
    </div>
</div>